﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Shpm.App.Input.Dao;
using Shpm.System;
using Shpm.App.Input.Bean;
using Shpm.App.Commons.Utils;

public partial class App_Input_VolunteerSrhForm : System.Web.UI.Page
{
    protected const string ACTION_TYPE = "F";

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            
        }
       
    }

    void Page_PreRender(object sender, EventArgs e)
    {
        HappyPlanResultDao dao = new HappyPlanResultDao();
        IList list = dao.FindHappyPlanResult();
        if (list.Count == 0)
        {
            ((Design_MasterPage)this.Master).InfoMessage =
                    "活动结果不存在，请确认！";
        }
        else
        {
            GridView1.DataSource = list;
            GridView1.DataBind();
        }
    }

    // page index change
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        // 设置分页编号
        GridView1.PageIndex = e.NewPageIndex;
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            HappyPlanResultBean bean = (HappyPlanResultBean)e.Row.DataItem;
            ((LinkButton)e.Row.FindControl("Step0")).CommandArgument = Convert.ToString(((HappyPlanResultBean)e.Row.DataItem).ActionResultId) ;
            ((LinkButton)e.Row.FindControl("Step1")).CommandArgument = Convert.ToString(((HappyPlanResultBean)e.Row.DataItem).ActionResultId);
            ((LinkButton)e.Row.FindControl("Step2")).CommandArgument = Convert.ToString(((HappyPlanResultBean)e.Row.DataItem).ActionResultId) ;


            e.Row.Cells[0].Text = Convert.ToString(e.Row.RowIndex + 1);
          
        }
    }
    protected void LinkButton_Command(object sender, CommandEventArgs e)
    {
        Context.Items["ACTION_ID"] = Convert.ToString(e.CommandArgument);
        
        if (e.CommandName == "Step1")
        {
            //过程开始
            //Server.Transfer("../Input/SaleProcesseMembership.aspx", true);
            ControllerUtils.Transfer(this.Context, "~/App/Input/HappyPlanResultForm.aspx", true);
        }
        else if (e.CommandName == "Step2")
        {
            //体检报告
            //Server.Transfer("../Input/SaleProcessHealthForm.aspx", true);
           // ControllerUtils.Transfer(this.Context, "~/App/Input/SaleProcessHealthForm.aspx", true);
        }
        else if (e.CommandName == "Step3")
        {
            //资格审核
            //Server.Transfer("../Input/SaleProcessIndefinForm.aspx", true);
            ControllerUtils.Transfer(this.Context, "~/App/Input/TimeBankForm.aspx", true);
        }
    }
    protected void btn_New_Click(object sender, EventArgs e)
    {
        Context.Items["ACTION_TYPE"] = ACTION_TYPE;
        ControllerUtils.Transfer(this.Context, "~/App/Input/HappyPlanResultForm.aspx", true);
    }
}
